/*
 * Copyright (c) 2018.
 * By:kaihangchen
 * E-mail:cmxds@hotmail.com
 */

package cn.cmxds.store.presenter.Impl;

import java.util.List;

import cn.cmxds.store.bean.HotResultsBean;
import cn.cmxds.store.http.ResultCallBack;
import cn.cmxds.store.model.IHotModel;
import cn.cmxds.store.model.Impl.HotModel;
import cn.cmxds.store.presenter.IHotPresenter;
import cn.cmxds.store.view.IHotView;

public class HotPresenter implements IHotPresenter{

    private IHotModel model;
    private IHotView view;

    public HotPresenter(IHotView view) {
        this.view = view;
       view.setPresenter(this);
    }

    @Override
    public void initData() {
        setModel();
        initView();
        initRecycleView();
    }
private void initView(){
     HotPresenter.this.view.initView();
}
    @Override
    public void refreshRecycleView() {
        model.refreshRecycleView(new ResultCallBack<List<HotResultsBean>>()
        {
            @Override
            public void onResponse(List<HotResultsBean> response) {
                HotPresenter.this.view.refreshRecycleView(response);
            }
        });
    }

    @Override
    public void loadMoreRecycleView() {
        model.loadMoreRecycleView(new ResultCallBack<List<HotResultsBean>>()
        {
            @Override
            public void onResponse(List<HotResultsBean> response) {
                HotPresenter.this.view.loadMoreRecycleView(response);
            }
        });
    }

    @Override
    public void initRecycleView() {
        model.initRecycleView(new ResultCallBack<List<HotResultsBean>>()
        {
            @Override
            public void onResponse(List<HotResultsBean> response) {
                HotPresenter.this.view.initRecycleView(response);
            }
        });
    }

    @Override
    public void setModel() {
        model= new HotModel();
    }
}
